//
//  DYShopAuthFooterView.m
//  kafuMerchant
//
//  Created by 帝云科技 on 2018/9/21.
//  Copyright © 2018年 帝云科技. All rights reserved.
//

#import "DYShopAuthFooterView.h"

@interface DYShopAuthFooterView ()

@property (nonatomic,strong)UILabel *titleLabel;
@property (nonatomic,strong)UIButton *arrayButton1;
@property (nonatomic,strong)UIButton *arrayButton2;
@property (nonatomic,strong)UIButton *submitButton;

@end

@implementation DYShopAuthFooterView

-(instancetype)initWithFrame:(CGRect)frame
{
    if (self=[super initWithFrame:frame]) {
        [self initView];
    }
    return self;
}
-(void)initView
{
    self.backgroundColor=WhiteColor;

    self.titleLabel=({
        UILabel *label=[Utils labelWithTitleFontSize:12 textColor:[UIColor xhq_content] alignment:0];
        label.text=@"支付方式";
        label;
    });
    
    self.arrayButton1=({
        UIButton *button=[Utils createBtnWithType:UIButtonTypeCustom backgroundColor:ClearColor action:@selector(buttonClick:) target:self title:@"  微信" image:@"icon_choose_n" font:14 textColor:[UIColor xhq_aTitle]];
        [button setImage:IMG(@"icon_choose_s") forState:UIControlStateSelected];
        button.contentHorizontalAlignment=UIControlContentHorizontalAlignmentLeft;
        button.selected=YES;
        button;
    });
    
    self.arrayButton2=({
        UIButton *button=[Utils createBtnWithType:UIButtonTypeCustom backgroundColor:ClearColor action:@selector(buttonClick:) target:self title:@"  支付宝" image:@"icon_choose_n" font:14 textColor:[UIColor xhq_aTitle]];
        [button setImage:IMG(@"icon_choose_s") forState:UIControlStateSelected];
        button.contentHorizontalAlignment=UIControlContentHorizontalAlignmentLeft;
        button;
    });
    
    self.submitButton =({
        UIButton * button=[Utils createBtnWithType:UIButtonTypeCustom backgroundColor:[UIColor xhq_base] action:@selector(buttonClick:) target:self title:@"支付认证" image:@"icon_login" font:17 textColor:WhiteColor];
        [button xhq_cornerRadius:BILIHEIGHT(19)];
        button;
    });
    
    [self addSubview:self.titleLabel];
    [self addSubview:self.arrayButton1];
    [self addSubview:self.arrayButton2];
    [self addSubview:self.submitButton];
    
    [self.titleLabel makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(BILIWIDTH(10));
        make.top.equalTo(BILIHEIGHT(10));
    }];
    
    [self.arrayButton1 makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(BILIWIDTH(10));
        make.top.equalTo(self.titleLabel.bottom).offset(BILIHEIGHT(6));
        make.height.equalTo(BILIHEIGHT(30));
    }];
    
    [self.arrayButton2 makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.arrayButton1.right).offset(BILIWIDTH(15));
        make.centerY.equalTo(self.arrayButton1);
        make.height.equalTo(self.arrayButton1);
    }];
    
    
    [self.submitButton makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.arrayButton1.bottom).offset(BILIHEIGHT(20));
        make.right.equalTo(BILIWIDTH(-10));
        make.size.equalTo(CGSizeMake(BILIWIDTH(132), BILIHEIGHT(38)));
    }];
    
    [self.submitButton placeImageTitlePosition:ZYButtonImagePositionRight space:BILIWIDTH(10)];
}
-(void)buttonClick:(UIButton *)button
{
    if (button==self.submitButton) {
        
    }else{
        self.arrayButton1.selected=NO;
        self.arrayButton2.selected=NO;
        button.selected=!button.selected;
    }
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
